﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.UI.Selection;
using YArchitech.Revit;

namespace YArchitech.HVAC
{
	public class DuctAndTerminalVerticalSelectionFilter : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			if (elem is Duct)
			{
				return true;
			}
			if (elem is FamilyInstance)
			{
				if (elem.Category.Id.IntegerValue != -2008013)
				{
					return false;
				}
				if (YJKRevitTools.GetElementConnector((Domain)1, elem).CoordinateSystem.BasisZ.Z == 0.0)
				{
					return true;
				}
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ position)
		{
			return false;
		}
	}
}
